import time
from page.login_page import LoginPage
from selenium.webdriver.common.by import By
class AddPage(LoginPage):
    # 点击支付管理
    click_loc=(By.XPATH,'//*[@id="sidebar"]/div[2]/div[7]/h2')
    def click01(self):
        self.click(self.click_loc)
    # 点击支付产品信息
    click02_loc=(By.XPATH,'//*[@id="sidebar"]/div[2]/div[8]/ul/li[1]/div/a')
    def click02(self):
        self.click(self.click02_loc)
    # 点击添加支付产品
    add_xinxi_loc=(By.CLASS_NAME,'add')
    def add_xinxi(self):
        self.click(self.add_xinxi_loc)
    # 支付产品编号
    productCode_loc = (By.NAME,'productCode')
    def productCode(self):
        self.send_keys(self.productCode_loc,'201')

    # 支付产品名称
    productName_loc = (By.XPATH, '//*[@id="navTab"]/div[2]/div[3]/div/form/div[1]/div/fieldset/dl[2]/dd/input')
    def productName(self):
        self.send_keys(self.productName_loc, '草莓冰激凌')
    # 点击提交
    submit_loc = (By.XPATH,'//*[@id="navTab"]/div[2]/div[3]/div/form/div[2]/ul/li[1]/div/div/button')
    def submit(self):
        self.click(self.submit_loc)

    def longguo_add(self):
        self.longguo_login()
        time.sleep(3)
        self.click01()
        time.sleep(3)
        self.click02()
        time.sleep(3)
        self.add_xinxi()
        time.sleep(3)
        self.productCode()
        time.sleep(3)
        self.productName()
        time.sleep(3)
        self.submit()
        time.sleep(3)
